package org.wwb.antbox.user.iservice.passport;

import org.ant.commons.models.model.BaseIdModel;
import org.ant.commons.models.result.BaseResult;
import org.ant.iservice.common.IBaseService;
import org.wwb.antbox.user.model.passport.model.PwdEditModel;
import org.wwb.antbox.user.model.passport.view.RoleNamesAndPermissionsView;
import org.wwb.antbox.user.model.user.entity.SysUser;
import org.wwb.antbox.user.model.user.model.SysUserFreezeModel;
import org.wwb.antbox.user.model.user.model.SysUserLoginModel;
import org.wwb.antbox.user.model.user.model.SysUserOnlineTimeModel;
import javax.security.auth.login.LoginException;

/**
 * @Author Bond
 * @Date: 2019/10/29 21:43
 * @Description: 用户登录相关服务接口
 */
public interface IPassportService extends IBaseService<SysUser, String> {

    /**
     * 登录校验系统用户名和密码
     * @param sysUserLoginModel 系统用户登录Model
     * @return BaseResult<SysUser>
     * @throws LoginException
     */
    BaseResult<SysUser> checkLoginSysUser(SysUserLoginModel sysUserLoginModel)  throws LoginException;

    /**
     * 根据当前用户Id 获取用户权限信息
     * @param userIdModel 用户id Model
     * @return
     */
    BaseResult<RoleNamesAndPermissionsView> getUserRoleNamesAndPermissions(BaseIdModel<String> userIdModel);

    /**
     * 更新系统用户在线总时长
     * @param sysUserOnlineTimeModel 更新系统用户在线总时长Model
     * @return
     */
    BaseResult<Boolean> updateSysUserTotalOnlineTime(SysUserOnlineTimeModel sysUserOnlineTimeModel);

    /**
     * 冻结系统用户
     * @param sysUserFreezeModel 冻结系统用户Model
     * @return
     */
    BaseResult<Boolean> updateSysUserToFreeze(SysUserFreezeModel sysUserFreezeModel);

    /**
     * 修改登录账号密码
     * @param pwdEditModel 冻结系统用户Model
     * @return
     */
    BaseResult<Integer> editLoginPwd(PwdEditModel pwdEditModel);
}
